package com.mymvc.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * ClassName: HelloController
 * Package: com.mymvc.controller
 * Description:
 *
 * @Author 刘英杰
 * @Create 2025/2/7 21:53
 * @Version 1.0
 */
public class HelloController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        ModelAndView modelAndView = new ModelAndView();
//        modelAndView.setViewName("/WEB-INF/jsp/index.jsp");//绝对路径
        modelAndView.setViewName("index");//相对路径
        modelAndView.addObject("name", "abc");
        return modelAndView;
    }
}
